
const toast = (message, position = 'bottom') => {
	uni.showToast({
		title: message,
		icon: 'none',
		position: position,
	})
}
const getScreenHeight = () => {
	return uni.getSystemInfoSync().windowHeight
}
const getScreenWidth = () => {
	return uni.getSystemInfoSync().windowWidth;
}
// 将token存储到本地
const setToken = (token) => {
	uni.setStorageSync('booksToken', token);
}
const setUser = (user) => {
	uni.setStorageSync('booksUserName', user);
}
//清除token
const cleanToken=()=>{
	uni.removeStorageSync('booksToken')
}
const getUser = () => {
	return uni.getStorageSync('booksUserName');
}
// 获取token
const getToken = () => {
	return uni.getStorageSync('booksToken');
}
//获取历史记录
const getHistory = () => {
	return uni.getStorageSync('booksHistory');
}
const setHistory = (keyWord) => {
	uni.setStorageSync('booksHistory', keyWord);
}
//清空历史记录
const cleanHistory=()=>{
	uni.removeStorageSync('booksHistory');
}
export default {
	toast,
	getScreenHeight,
	getScreenWidth,
	setToken,
	getToken,
	setUser,
	getUser,
	setHistory,
	getHistory,
	cleanHistory,
	cleanToken

}
